require 'IOHelper'

#Validate Arguments--------------------------------
unless ARGV.length >= 1
	puts "To Use: remove-dirs-recursive.rb directory_name (required) root_path (optional, default = current directory) silent (optional, default = false)"
	puts "To Use: try 'remove-dirs-recursive.rb help' for more information"
	exit
end
if ARGV.length == 1 && ARGV[0] == "help" then
	puts "Help------------------------------------------------------------"
	puts "To Use: remove-dirs-recursive.rb directory_name (required) root_path (optional, default = current directory) silent (optional, default = false)"
	puts ""
	puts "Example: To remove all the bin directories from current directory and print out trace"
	puts "         remove-dirs-recursive.rb bin"
	puts ""
	puts "Example: To remove all the bin directories from c:\development and print out trace"
	puts "         remove-dirs-recursive.rb bin c\\:development\\ "
	puts ""
	puts "Example: To remove all the bin directories from c:\development without trace"
	puts "         remove-dirs-recursive.rb bin c\\:development\\ true" 
	puts ""
	puts "Help------------------------------------------------------------"
	exit
end

#Process Arguments---------------------------------
@directoryName = ARGV[0]
if ARGV[1] == nil then
	@rootPath = './'
else
	@rootPath = ARGV[1]
end
if ARGV[2] == nil then
	@silent = false
else
	@silent = ARGV[2]
end

puts "Using:"
puts "Root Path: #{@rootPath}"
puts "Directory Name: #{@directoryName}"
puts "Silent: #{@silent}"

rm = IOHelper.new
rm.remove_directory_recursive_by_name @directoryName, @rootPath, @silent	


